package code;

import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

public class two {
    public static void main(String[] args) throws IOException {
      while(true) {
          Socket socket = new Socket("192.168.1.118", 8888);

          InputStream inputStream = new FileInputStream("E:\\photo1\\tu.jpg");

          OutputStream outputStream = socket.getOutputStream();
          BufferedReader result = new BufferedReader(new InputStreamReader(socket.getInputStream()));
          int b = 0;
          while ((b = inputStream.read()) != -1) {
              outputStream.write(b);
          }
          socket.shutdownOutput();
          System.out.println(result.readLine());
      }
    }
}
